import { get } from '@/api/common'

export default {
  // 获得账单记录
  getBills(buildingId, estateId, userName,cb,errCb) {
    let body = {
        '@column': 'id,contract_id,user_id,is_last,totle_price,rent',
        '@order': 'lease_date-',
        };
    let cBody = {
        '@column': 'id,building_id,estate_id',
        'id@': '/Mk_bill/contract_id',
    }
    let bBody= {
        '@column': 'id,title',
        'id@': '/Mk_contract/building_id',   
    }
    if(buildingId>0)
      bBody['id'] = buildingId
    let eBody = {
        '@column': 'id,house_room_num',
        'id@': '/Mk_contract/estate_id', 
    }
    if(estateId>0)
      eBody['id'] = estateId;
    let uBody = {
        '@column': 'id,nick_name',
        'id@': '/Mk_bill/user_id',    
    }
    if(userName!=undefined&&userName!='')
      uBody['id$'] = '%'+userId+'%';
      
    let params = {
      '[]': {
        'Mk_bill': body,
        'Mk_contract': cBody,
        'Mk_building': bBody,
        'Mk_estate': eBody,
        'Mk_user': uBody,
      }
    };
    get(params,cb,errCb);
  },


}